import React, { FC, useEffect } from "react";
import { useNavigate, Link } from "react-router-dom";
import { Button, Typography } from "antd";
import { MANAGE_INDEX_PATHNAME } from "../router";
import styles from "./Home.module.scss";
// import "../__mock/index.ts";
import axios from "axios";

const { Title, Paragraph } = Typography;

const Home: FC = () => {
  const nav = useNavigate();

  useEffect(() => {
 
    axios.get("/api/test").then((res) => {
      console.log(res.data);
    });
  });
  // const nav = useNavigate(); 

  // Reat18 环境下， useEffect 在开发环境下，会执行两次
  // useEffect(() => {
  //   // fetch("/api/test").then((res) => {
  //   //   console.log(res);
  //   // });

  //   axios.get('/api/test').then((res) => {
  //     console.log(res);
  //   })
  // },[])
  // function handleClick() {
  //   // nav("/login");
  //   nav({
  //     pathname: "/login",
  //     search: "b=21",
  //   });
  // }
  return (
    <div className={styles.container}>
      <div className={styles.info}>
        <Title>问卷调查 | 在线投票</Title>
        <Paragraph>Paragraph</Paragraph>
        <Button type="primary" onClick={() => nav(MANAGE_INDEX_PATHNAME)}>
          开始使用
        </Button>
      </div>
    </div>
  );
};

export default Home;
